test consuming CMake package
authorKevin Albertson <kevin.eric.albertson@gmail.com>
Sat, 17 May 2025 13:52:36 +0000 (09:52 -0400)
committerKevin Albertson <kevin.eric.albertson@gmail.com>
Sat, 17 May 2025 18:37:45 +0000 (14:37 -0400)
.github/workflows/cmake.yml
.gitignore
test/app/CMakeLists.txt [new file with mode: 0644]
test/app/app.c [new file with mode: 0644]

index 28814405ef285e1e67813853ce236cb376dabb45..a9cc4cb88efefc519f4188e41398b5985004bfbf 100644 (file)
@@ -33,6 +33,21 @@ jobs:
         path: |
           build/libutf8proc.*
           build/Debug/utf8proc.*
+    - name: Test Consuming (Windows)
+      if: ${{ matrix.os == 'windows-latest' }}
+      run: |
+        cmake --install build --prefix tmp/install --config Debug
+        cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install
+        cmake --build test/app/build
+        $env:PATH+=";$PWD/tmp/install/bin"
+        test/app/build/Debug/app.exe
+    - name: Test Consuming (Unix)
+      if: ${{ matrix.os != 'windows-latest' }}
+      run: |
+        cmake --install build --prefix tmp/install
+        cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install
+        cmake --build test/app/build
+        test/app/build/app
 
   mingw:
     strategy:
@@ -62,3 +77,10 @@ jobs:
       with:
         name: windows-mingw64
         path: build/libutf8proc.*
+    - name: Test Consuming
+      run: |
+        cmake --install build --prefix tmp/install
+        cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install -G'MSYS Makefiles'
+        cmake --build test/app/build
+        export PATH="$PATH:$(pwd)/tmp/install/bin"
+        test/app/build/app.exe
index ab91d1d719c9b3d9d373fd10559965469d10a9fd..d25513499475b7050dbbc4a0be533af9c46e80fb 100644 (file)
@@ -28,6 +28,7 @@
 /test/case
 /test/iscase
 /test/custom
+/test/app/build
 /tmp/
 /mingw_static/
 /mingw_shared/
diff --git a/test/app/CMakeLists.txt b/test/app/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9d9786c
--- /dev/null
@@ -0,0 +1,6 @@
+# This is a test app to test consuming utf8proc with CMake.
+cmake_minimum_required(VERSION 3.16)
+project(utf8proc-test)
+find_package(utf8proc REQUIRED)
+add_executable(app app.c)
+target_link_libraries(app utf8proc::utf8proc)
diff --git a/test/app/app.c b/test/app/app.c
new file mode 100644 (file)
index 0000000..4b6f8be
--- /dev/null
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <utf8proc.h>
+
+int
+main(void)
+{
+  printf("%s\n", utf8proc_version());
+  return 0;
+}